Skip to content

fix(stack): Decouple fullscreen stacking layer from focus#4077

Open
Watkurem wants to merge 1 commit intoawesomeWM:masterfrom
Watkurem:fix-firefox-fullscreen-stack
Open

fix(stack): Decouple fullscreen stacking layer from focus#4077
Watkurem wants to merge 1 commit intoawesomeWM:masterfrom
Watkurem:fix-firefox-fullscreen-stack

Conversation

@Watkurem
Copy link
Copy Markdown
Contributor

@Watkurem Watkurem commented Mar 8, 2026

Fixes #4075

Fullscreen clients are assigned a special stacking layer via client_layer_translator(). Previously, this was conditioned on the client having focus. When switching focus away from a fullscreen client (e.g. via awful.client.focus.byidx), the fullscreen client could intermittently remain visually on top despite losing focus, because the layer reassignment depended on a restack that was not always triggered by the focus change.

This is fixed by conditioning the fullscreen layer on the client being at the top of the internal stack (i.e. the most recently raised client) rather than on focus. Since keyboard focus changes go through raise(), the fullscreen layer is correctly updated when switching away. Sloppy mouse-enter focus (which does not call raise) is unaffected, as it does not alter the internal stack order.

I'm wondering whether this has a potential of causing issues when the client is set as fullscreen without raising (when could this happen? Could a client be spawned as fullscreen, but not raised? Should it even be given its own layer in that case?). One might switch to a client without raising it — but, once again, should the client be given its own layer in that case?

Admittedly, I'm not very familiar with Awesome's internals and don't really know what I'm doing, but, hopefully, this is at least close to a proper fix.

I'm not sure how to properly auto-test for this... Let me know in case a test is required, and I'll try to figure it out.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.47%. Comparing base (4960086) to head (3279beb).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4077      +/-   ##
==========================================
- Coverage   90.47%   90.47%   -0.01%     
==========================================
  Files         941      941              
  Lines       60391    60392       +1     
  Branches     1145     1145              
==========================================
- Hits        54638    54637       -1     
- Misses       5246     5248       +2     
  Partials      507      507              
Files with missing lines Coverage Δ
stack.c 93.33% <100.00%> (+0.11%) ⬆️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Watkurem Watkurem force-pushed the fix-firefox-fullscreen-stack branch from 1f77055 to 1451edd Compare March 30, 2026 21:51
Fullscreen clients are assigned a special stacking layer via
client_layer_translator(). Previously, this was conditioned on the
client having focus. When switching focus away from a fullscreen client
(e.g. via awful.client.focus.byidx), the fullscreen client could
intermittently remain visually on top despite losing focus, because the
layer reassignment depended on a restack that was not always triggered
by the focus change.

This is fixed by conditioning the fullscreen layer on the client being
at the top of the internal stack (i.e. the most recently raised client)
rather than on focus. Since keyboard focus changes go through raise(),
the fullscreen layer is correctly updated when switching away. Sloppy
mouse-enter focus (which does not call raise) is unaffected, as it does
not alter the internal stack order.

Signed-off-by: Alexander Melnyk <inboxnumberzero@zoho.com>
@Watkurem Watkurem force-pushed the fix-firefox-fullscreen-stack branch from 1451edd to 3279beb Compare March 30, 2026 21:52
@Watkurem
Copy link
Copy Markdown
Contributor Author

I found an issue with my original attempt at this fix. Forcing a restack on every focus broke "sloppy focus" (as in, focusing a window when the mouse cursor enters it, but without raising it to visibility), which, at least for me, is a big deal. I didn't notice this problem at first, because all my fullscreen clients sit on the same tag (so it's normally impossible to do sloppy focus stuff with them) 🤡

After digging into it some more, I took a different approach, which seems to make more sense (and which I didn't find a way to break yet). Input would be appreciated, though.

@Watkurem Watkurem changed the title fix(stack): Restack windows on focus change for fullscreen layer fix(stack): Decouple fullscreen stacking layer from focus Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fullscreen Firefox intermittently stays visually on top, ignoring client focus

1 participant